package com.thewaybetter.modules.client.pages;

import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;

public abstract class AbstractPage {

	private boolean isModified = false;
	
	private static final String BASE_DIV = "content";
	
	private RootPanel root = RootPanel.get(BASE_DIV); 
	
	protected abstract void drawPage();
	protected abstract void initComponents();
	
	public void showPage(){
		clearPage();
		initComponents();
		drawPage();
	}
	
	protected final void addToPage(Widget w){
		root.add(w);
		isModified = true;
	}
	
	protected final void clearPage(){
		root.clear();
	}
	
	protected final RootPanel addTo(String id){
		return RootPanel.get(id);
	}
	
}
